#ifndef RS485_DIR_H
#define RS485_DIR_H 

#define WRITE_POWER_STATUS _IOW('S',2,unsigned long)

struct rs485_dir_t{
  struct rs485_dir_msg_t{
    enum rs485_dir_mode_t 
    {
      SET_MODE = 1,
      FREE_MODE = 2,
      SEND_MODE = 3,
      RECV_MODE = 4
    }mode;
    struct rs485_dir_num_t
    {
      int de;
      int re;
    }num;
  }msg;
  int fd;
  char dev[30];
  int gpio_de;
  int gpio_re;
  void (*open)(void);
  void (*close)(void);
  void (*set_mode)(enum rs485_dir_mode_t mode);
  void (*set_gpio)(int de, int re);
  void (*set_dev)(char *dev, int len);
};


extern struct rs485_dir_t rs485_dir;

void rs485_dir_init(void);
#endif
